from mpl_toolkits.mplot3d import Axes3D
import numpy as np
from matplotlib import pyplot as plt
import q2

modelA=q2.dingjiaModel('model.pkl')

def f(x,y):
    Z=[]
    for i in range(x.shape[0]):
        xi=x[i]
        yi=y[i]
        X=[[yi[j],xi[j]] for j in range(len(xi))]
        X=np.array(X)
        z=modelA.predict(X)
        z=z.T[0]
        print(z)
        print(z.shape)
        Z.append(z)
    return np.array(Z)

fig = plt.figure()
ax = Axes3D(fig)
x=np.arange(20,30,0.05)
y=np.arange(110,120,0.05)
X,Y = np.meshgrid(x, y)
Z=f(X,Y)
print(Z)
print(Z.shape)
plt.xlabel('x')
plt.ylabel('y')
ax.plot_surface(x, y, Z, rstride=1, cstride=1, cmap='rainbow')
plt.show()